<?php

/**
 * Abstract Class to components
 */
abstract class Z_Component {

    private $components;
    protected $beforeRenderTag = "";
    protected $afterRenderTag = "";

    public function __construct($beforeRenderTag="", $afterRenderTag="") {
        $this->components = array();
        $this->beforeRenderTag = $beforeRenderTag;
        $this->afterRenderTag = $afterRenderTag;
    }

    public function render() {
        $r = $this->beforeRenderTag;


        foreach ($this->components as $component) {

            if (Z_App::getConf()->debug->dumpObjects == true) {
                var_dump($component);
                echo "<br><br>";
            }


            $r .= $component->render();
        }
        $r .= $this->afterRenderTag;
        return $r;
    }

    public function add($component)
    {
        $this->components[] = $component;
                
    }

    

}